package com.yanchangapp.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yanchangapp.R;
import com.yanchangapp.model.bean.PsOrderListBean;
import com.zxl.baselib.util.formatter.BigDecimalUtils;
import com.zxl.baselib.util.ui.ResHelper;

import java.util.List;

/**
 * Created by apple on 2019-08-06.
 * description: 商品水平Adapter
 */
public class ProductHAdapter extends BaseQuickAdapter<PsOrderListBean.ProductsBean, BaseViewHolder> {

    public ProductHAdapter(int layoutResId, @Nullable List<PsOrderListBean.ProductsBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, PsOrderListBean.ProductsBean productsBean) {
        baseViewHolder.setText(R.id.tvName,productsBean.getProductName());
        baseViewHolder.setText(R.id.tvPrice, ResHelper.getString(R.string.product_price, BigDecimalUtils.keep2Decimal(productsBean.getPrice())));
        baseViewHolder.setText(R.id.tvNum,ResHelper.getString(R.string.product_num,productsBean.getOrderNum()));
    }
}
